/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sifisy.connections;


import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.prefs.Preferences;


import sifisy.newgui.*;
import sifisy.core.Model;

/**
 *
 * @author Alessandro Vedovato
 */
public class PreferencesManager extends Controller{
    private PreferencesWizard preferencesWizard;

    public PreferencesManager(PreferencesWizard wizard) {
        preferencesWizard = wizard;
    }

    /**
     * Inner class that call Model to change SiFiSy setup
     */
    public class ChangeSetup extends MouseAdapter {

        /**
         * Method that call Model to change SiFiSy setup
         * @param e
         */
        @Override
        public void mouseClicked(MouseEvent e) {
            Model.setLanguage(preferencesWizard.getLanguage_c().getSelectedItem().toString());
            if(preferencesWizard.getWizard_c().getSelectedIndex() == 0) {
                Model.setShowWizard("true");
            }
            else {
                Model.setShowWizard("false");
            }

            // Roba da smanettoni

            Model.setDefaultSimulationPath(preferencesWizard.getDefaultSimulationPath_t().getText());
            Model.setSchemaPath(preferencesWizard.getSchemaPath_t().getText());
            Model.setGuiTranslatePath(preferencesWizard.getGuiTranslatePath_t().getText());

            Model.saveSetup();

            preferencesWizard.dispose();
        }
    }
}